Skip to content

Fix sidebar rendering bugs #1233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 1, 2021
Merged

Fix sidebar rendering bugs #1233

merged 2 commits into from
Jan 1, 2021

Conversation

arusahni
Copy link
Contributor

@arusahni arusahni commented Jan 1, 2021

This corrects two bugs with the sidebar's presentation:

  • The CSS selector to reposition the top offset of the rustdoc sidebar menu was not being applied to the element. It also updates the magic number to be less magical ✨ (Fixes Mobile: Opening rustdoc hamburger menu overlaps rustdoc header #1121)
  • Due to the padding being applied to the rustdoc container, the sidebar nav's sizing and position was offset, resulting in some jank. This addresses it.
    • Before: Before
    • After: After

The fixes are grouped by commit so they can be separately reviewed.

Thanks, and Happy New Year! 🎆 🤞

@jyn514
Copy link
Member

jyn514 commented Jan 1, 2021

Please drop the clippy commits, those were fixed in #1235.

This corrects a bug where the CSS selcetor to reposition the top of the
rustdoc sidebar was no longer applied to the element. It also updates
the magic number to be less magic.

Fixes rust-lang#1121
@arusahni
Copy link
Contributor Author

arusahni commented Jan 1, 2021

Clippy commits removed, and this PR has been rebased on master.

@jyn514 jyn514 added A-frontend Area: Web frontend S-waiting-on-author Status: This PR is incomplete or needs to address review comments S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels Jan 1, 2021
@jyn514
Copy link
Member

jyn514 commented Jan 1, 2021

Due to the padding being applied to the rustdoc container, the sidebar nav's sizing and position was offset, resulting in some jank. This addresses it.

I still see some issues with this (I have it open on desktop, taking up half of the screen).

Sidebar closed
Sidebar open

Notice how 'Regex' and 'Version' move over to the right when you open the sidebar. I'm ok with fixing that in a follow-up, but do you think it would be easy to fix here?

@jyn514 jyn514 added S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Jan 1, 2021
@arusahni
Copy link
Contributor Author

arusahni commented Jan 1, 2021

I'm in favor of getting it sorted out in this PR so we don't have to revisit it. I'll try to replicate and address. 👍

This addresses some visible jank caused by the sidebar nav container
overflow changing the rendered size.
@arusahni
Copy link
Contributor Author

arusahni commented Jan 1, 2021

Alright - this was a fun difference in how Firefox (which I was developing and testing in) and Chrome handled scrollbars and overflow. I've pushed an update that still results in a jump, but I confirmed locally that the jump is also present with rustdocs. Here's a comparison screencap. Given consistency is our goal, this feels like the most-correct course of action.

@jyn514
Copy link
Member

jyn514 commented Jan 1, 2021

I agree it's better to fix this in rustdoc than special case docs.rs. If you're interested in working on that let me know :)

Thanks for working on this!

@jyn514 jyn514 merged commit 8966c52 into rust-lang:master Jan 1, 2021
@jyn514 jyn514 removed the S-waiting-on-author Status: This PR is incomplete or needs to address review comments label Jan 1, 2021
@arusahni
Copy link
Contributor Author

arusahni commented Jan 2, 2021

@jyn514 I'd love to tackle the root cause in rustdoc! 🛠️

@jyn514
Copy link
Member

jyn514 commented Jan 2, 2021

@arusahni awesome! I'd take a look around https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/rustdoc.css. There's instructions for building rustdoc at https://rustc-dev-guide.rust-lang.org/rustdoc.html. Feel free to ask for help on Zulip if you need it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Web frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mobile: Opening rustdoc hamburger menu overlaps rustdoc header
2 participants